home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 076-100 / scopedisk86 / maze12 / source / about.c next >
Encoding:
C/C++ Source or Header  |  1995-03-19  |  8.0 KB  |  241 lines

  1. #include <exec/types.h>
  2. #include <graphics/view.h>
  3. #include <intuition/intuition.h>
  4. #include <functions.h>
  5. #include <libraries/dos.h>
  6. #include <libraries/dosextens.h>
  7.  
  8. extern struct Window *window;
  9. extern ULONG RangeRand();
  10. extern struct TextAttr font;
  11.  
  12. cycle(color) int color;
  13. {   struct ColorMap *cm;
  14.     struct ViewPort *vp;
  15.     UWORD orig, r, g, b, ro, go, bo;
  16.     int i;
  17.  
  18.     vp = ViewPortAddress( window );
  19.     cm = vp -> ColorMap;
  20.  
  21.     orig = GetRGB4( cm, (LONG) color );
  22.     b = (bo = (orig     ) & 15);
  23.     g = (go = (orig >> 4) & 15);
  24.     r = (ro = (orig >> 8) & 15);
  25.  
  26.     for (i=0; i<1000; i++) {
  27.         r = RangeRand(2L) * 15;
  28.         g = RangeRand(2L) * 15;
  29.         b = RangeRand(2L) * 15;
  30.         SetRGB4(vp,(LONG)color,(LONG)r,(LONG)g,(LONG)b);
  31.         }
  32.     SetRGB4(vp,(LONG)color,(LONG)ro,(LONG)go,(LONG)bo);
  33.     }
  34.  
  35. #define reqW  544
  36. #define reqH  152
  37. #define centerX(chars) (reqW/2 - (chars)*8/2)
  38. #define centerXright(chars) (reqW - 111 - (chars)*8/2)
  39. #define centerXleft(chars) (111 - (chars)*8/2)
  40.  
  41. SHORT reqborderXY[] = { 2,1, 541,1, 541,150, 2,150, 2,1 };
  42.  
  43. struct Border reqborder = {
  44.         0,0,        /* LeftEdge, TopEdge */
  45.         1,1,        /* FrontPen, BackPen */
  46.         JAM1,       /* DrawMode */
  47.         5,          /* Count */
  48.         reqborderXY,/* SHORT *XY */
  49.         NULL,       /* NextBorder */
  50.         };
  51.  
  52. SHORT gadborderXY[] = { 2,1, 97,1, 97,28, 2,28, 2,1 };
  53.  
  54. struct Border gadborder = {
  55.         2,1,        /* LeftEdge, TopEdge */
  56.         1,2,        /* FrontPen, BackPen */
  57.         JAM2,       /* DrawMode */
  58.         5,          /* Count */
  59.         gadborderXY,   /* SHORT *XY */
  60.         NULL,       /* NextBorder */
  61.         };
  62.  
  63. struct IntuiText gadtext = {
  64.         1,2,      /* FrontPen, BackPen */
  65.         JAM1,     /* DrawMode */
  66.         18,11,    /* LeftEdge, TopEdge */
  67.         &font,     /* TextAttr *ITextFont */
  68.         (UBYTE *) "Continue", /* IText */
  69.         NULL,     /* struct IntuiText *NextText */
  70.         };
  71.  
  72. struct Gadget aboutgad = {
  73.         NULL,          /* NextGadget */
  74.         222,117,100,30,  /* LeftEdge, TopEdge, Width, Height */
  75.         GADGHNONE,         /* Flags */
  76.         ENDGADGET | TOGGLESELECT,  /* Activation Flags */
  77.         REQGADGET | BOOLGADGET, /* GadgetType */
  78.         (APTR)&gadborder,       /* GadgetRender */
  79.         NULL,       /* SelectRender */
  80.         &gadtext,       /* GadgetText   */
  81.         NULL,       /* MutualExclude */
  82.         NULL,       /* SpecialInfo  */
  83.         0,          /* GadgetID     */
  84.         NULL,       /* UserData     */
  85.         };
  86.  
  87. struct IntuiText  ab_txt8= {
  88.         3,2,    /* FrontPen, BackPen */
  89.         JAM1,   /* DrawMode */
  90.         20,102,    /* LeftEdge, TopEdge */
  91.         &font,   /* TextAttr *ITextFont */
  92.         (UBYTE *) "Comments and suggestions are welcome.", /* IText */
  93.         NULL,   /* struct IntuiText *NextText */
  94.         };
  95. struct IntuiText  ab_txt7= {
  96.         3,2,    /* FrontPen, BackPen */
  97.         JAM1,   /* DrawMode */
  98.         20,92,    /* LeftEdge, TopEdge */
  99.         &font,   /* TextAttr *ITextFont */
  100.         (UBYTE *) "writing it.  Please feel free to share it with your friends.
  101. , /* IText */
  102.         &ab_txt8,   /* struct IntuiText *NextText */
  103.         };
  104. struct IntuiText  ab_txt6= {
  105.         3,2,    /* FrontPen, BackPen */
  106.         JAM1,   /* DrawMode */
  107.         20,82,    /* LeftEdge, TopEdge */
  108.         &font,   /* TextAttr *ITextFont */
  109.         (UBYTE *) "   I hope you enjoy playing this game as much as I enjoyed",
  110. /* IText */
  111.         &ab_txt7,   /* struct IntuiText *NextText */
  112.         };
  113. struct IntuiText  ab_inst3= {
  114.         3,2,    /* FrontPen, BackPen */
  115.         JAM1,   /* DrawMode */
  116.         20,68,    /* LeftEdge, TopEdge */
  117.         &font,   /* TextAttr *ITextFont */
  118.         (UBYTE *) "give you a hint.  Select new mazes from the menu.  Good luck
  119. ", /* IText */
  120.         &ab_txt6,   /* struct IntuiText *NextText */
  121.         };
  122. struct IntuiText  ab_inst2= {
  123.         3,2,    /* FrontPen, BackPen */
  124.         JAM1,   /* DrawMode */
  125.         20,59,    /* LeftEdge, TopEdge */
  126.         &font,   /* TextAttr *ITextFont */
  127.         (UBYTE *) "red spot to the dark red spot.  The left mouse button will",
  128. /* IText */
  129.         &ab_inst3,   /* struct IntuiText *NextText */
  130.         };
  131. struct IntuiText  ab_inst1= {
  132.         3,2,    /* FrontPen, BackPen */
  133.         JAM1,   /* DrawMode */
  134.         20,50,    /* LeftEdge, TopEdge */
  135.         &font,   /* TextAttr *ITextFont */
  136.         (UBYTE *) "   Move the mouse pointer through the maze from the bright",
  137. /* IText */
  138.         &ab_inst2,   /* struct IntuiText *NextText */
  139.         };
  140. struct IntuiText  ab_left2= {
  141.         3,2,    /* FrontPen, BackPen */
  142.         JAM1,   /* DrawMode */
  143.         centerXleft(19),120,    /* LeftEdge, TopEdge */
  144.         &font,   /* TextAttr *ITextFont */
  145.         (UBYTE *) "Usenet Distribution", /* IText */
  146.         &ab_inst1,   /* struct IntuiText *NextText */
  147.         };
  148. struct IntuiText  ab_left1= {
  149.         3,2,    /* FrontPen, BackPen */
  150.         JAM1,   /* DrawMode */
  151.         centerXleft(12),130,    /* LeftEdge, TopEdge */
  152.         &font,   /* TextAttr *ITextFont */
  153.         (UBYTE *) "Spring, 1989", /* IText */
  154.         &ab_left2,   /* struct IntuiText *NextText */
  155.         };
  156. struct IntuiText  ab_txt5= {
  157.         3,2,    /* FrontPen, BackPen */
  158.         JAM1,   /* DrawMode */
  159.         centerXright(24),140,    /* LeftEdge, TopEdge */
  160.         &font,   /* TextAttr *ITextFont */
  161.         (UBYTE *) "utoddl@ecsvax.uncecs.edu", /* IText */
  162.         &ab_left1,   /* struct IntuiText *NextText */
  163.         };
  164. struct IntuiText  ab_txt4= {
  165.         3,2,    /* FrontPen, BackPen */
  166.         JAM1,   /* DrawMode */
  167.         centerXright(20),130,    /* LeftEdge, TopEdge */
  168.         &font,   /* TextAttr *ITextFont */
  169.         (UBYTE *) "utoddl@ecsvax.BITNET", /* IText */
  170.         &ab_txt5,   /* struct IntuiText *NextText */
  171.         };
  172. struct IntuiText  ab_txt3= {
  173.         3,2,    /* FrontPen, BackPen */
  174.         JAM1,   /* DrawMode */
  175.         centerXright(21),120,    /* LeftEdge, TopEdge */
  176.         &font,   /* TextAttr *ITextFont */
  177.         (UBYTE *) "Author: Todd M. Lewis", /* IText */
  178.         &ab_txt4,   /* struct IntuiText *NextText */
  179.         };
  180. struct IntuiText  ab_txt2= {
  181.         3,2,    /* FrontPen, BackPen */
  182.         JAM1,   /* DrawMode */
  183.         centerX(32),35,    /* LeftEdge, TopEdge */
  184.         &font,   /* TextAttr *ITextFont */
  185.         (UBYTE *) "The Disk Magazine for the Amiga.", /* IText */
  186.         &ab_txt3,   /* struct IntuiText *NextText */
  187.         };
  188. struct IntuiText  ab_txt1= {
  189.         3,2,    /* FrontPen, BackPen */
  190.         JAM1,   /* DrawMode */
  191.         centerX(30),25,    /* LeftEdge, TopEdge */
  192.         &font,   /* TextAttr *ITextFont */
  193.         (UBYTE *) "First distributed on JUMPDISK,", /* IText */
  194.         &ab_txt2,   /* struct IntuiText *NextText */
  195.         };
  196. struct IntuiText  ab_txt0= {
  197.         3,2,    /* FrontPen, BackPen */
  198.         JAM1,   /* DrawMode */
  199.         centerX(33),15,    /* LeftEdge, TopEdge */
  200.         &font,   /* TextAttr *ITextFont */
  201.         (UBYTE *) "Copyright (c) 1988, Todd M. Lewis", /* IText */
  202.         &ab_txt1,   /* struct IntuiText *NextText */
  203.         };
  204. struct IntuiText firsttext = {
  205.         3,2,    /* FrontPen, BackPen */
  206.         JAM1,   /* DrawMode */
  207.         centerX(27),6,    /* LeftEdge, TopEdge */
  208.         &font,   /* TextAttr *ITextFont */
  209.         (UBYTE *) "TML's AmigaMaze version 1.2", /* IText */
  210.         &ab_txt0,   /* struct IntuiText *NextText */
  211.         };
  212.  
  213. struct Requester aboutreq;
  214.  
  215. about()
  216. {   struct IntuiMessage *msg;
  217.     int class;
  218.  
  219.     InitRequester( &aboutreq );
  220.  
  221.     aboutreq.LeftEdge   = 4;
  222.     aboutreq.TopEdge    = 15;
  223.     aboutreq.Width      = reqW;
  224.     aboutreq.Height     = reqH;
  225.     aboutreq.ReqGadget  = &aboutgad;
  226.     aboutreq.ReqText    = &firsttext;
  227.     aboutreq.ReqBorder  = &reqborder;
  228.     aboutreq.BackFill   = 2;      /* BLACK */
  229.  
  230.     if (Request( &aboutreq, window )) {
  231.        do {
  232.              Wait( 1L << window->UserPort->mp_SigBit );
  233.              while (msg = (struct IntuiMessage *)GetMsg( window->UserPort )) {
  234.                  class = msg->Class;
  235.                  ReplyMsg(msg);
  236.                  }
  237.              } while ( class != REQCLEAR );
  238.        }
  239.    }
  240.  
  241.